//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Payton Byrd">
//     Copyright (c) 2007 Payton Byrd.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace CBM_Commander.Common.Encoding
{
    public class Petscii : System.Text.Encoding
    {
        public static PetsciiEncoder GetPetsciiEncoder()
        {
            return new PetsciiEncoder();
        }

        public static PetsciiDecoder GetPetsciiDecoder()
        {
            return new PetsciiDecoder();
        }

        public override int GetByteCount(
            char[] chars,
            int index,
            int count)
        {
            return GetPetsciiEncoder().GetByteCount(
                chars, index, count, false);
        }

        public override int GetBytes(
            char[] chars,
            int charIndex,
            int charCount,
            byte[] bytes,
            int byteIndex)
        {
            return GetPetsciiEncoder().GetBytes(
                chars, charIndex, charCount,
                bytes, byteIndex, false);
        }

        public override int GetCharCount(
            byte[] bytes,
            int index,
            int count)
        {
            return GetPetsciiDecoder().GetCharCount(
                bytes, index, count);
        }

        public override int GetChars(
            byte[] bytes,
            int byteIndex,
            int byteCount,
            char[] chars,
            int charIndex)
        {
            return GetPetsciiDecoder().GetChars(
                bytes, byteIndex, byteCount,
                chars, charIndex);
        }

        public override int GetMaxByteCount(int charCount)
        {
            return charCount;
        }

        public override int GetMaxCharCount(int byteCount)
        {
            return byteCount;
        }
    }
}